namespace DesignPattern.Behavioral.Iterator
{
    public class DaysIterator : IIterator
    {
        private string[] _days;

        private int _index = -1;

        public DaysIterator(string[] days)
        {
            _days = days;
        }

        public bool HasNext()
        {
            return _index < _days.Length;
        }

        public object First()
        {
            _index = 0;
            return _days[_index];
        }

        public object Next()
        {
            if (HasNext())
            {
                return _days[++_index];
            }
            return null;
        }
    }
}